﻿using EFCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SIService;
using SService;

namespace WMSWeb.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SyskcallotController : ControllerBase
    {

        private readonly WmssystemContext myDb;
        private readonly SyskcallotS syskcallotS;

        public SyskcallotController(WmssystemContext myDb, SService.SyskcallotS syskcallotS)
        {
            this.myDb = myDb;
            this.syskcallotS = syskcallotS;
        }
        /// <summary>
        /// 3个条件分页查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<Sys_kc_allot>> Fye(int pageSize, int currentPage, string Number = null, string Status = null, DateTime? date = null, DateTime? date1 = null)
        {
            return await syskcallotS.Fye(pageSize, currentPage, Number, Status, date, date1);
        }
        /// <summary>
        /// 查询总行数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<Sys_kc_allot>> Qu()
        {
            return await syskcallotS.Qu();
        }
        /// <summary>
        /// 调拨表添加数据
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> Add(Sys_kc_allot sys_Kc_Allot)
        {
            return await syskcallotS.Add(sys_Kc_Allot);
        }
        /// <summary>
        /// 调拨审核
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> DbShen(Sys_kc_allot sys_Kc_Allot, string to)
        {
            return await syskcallotS.DbShen(sys_Kc_Allot, to);
        }
        /// <summary>
        /// 调拨批量删除
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public async Task<int> DbDel(List<int> Ids)
        {
            return await syskcallotS.DbDel(Ids);
        }
        /// <summary>
        /// 调拨修改
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> DbUpd(Sys_kc_allot sys_Kc_Allot)
        {
            return await syskcallotS.DbUpd(sys_Kc_Allot);
        }
    }
}
